package com.t5.bo;

import javax.persistence.Embeddable;
import java.io.Serializable;

@Embeddable
public class ProviderId implements Serializable {
  private String id;
  private ProviderType type;

  public ProviderId(String id, ProviderType type) {
    this.id = id;
    this.type = type;
  }

  public ProviderId() {
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public ProviderType getType() {
    return type;
  }

  public void setType(ProviderType type) {
    this.type = type;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    ProviderId that = (ProviderId) o;

    return !(id != null ? !id.equals(that.id) : that.id != null) && type == that.type;
  }

  @Override
  public int hashCode() {
    int result = id != null ? id.hashCode() : 0;
    result = 31 * result + (type != null ? type.hashCode() : 0);
    return result;
  }
}
